//
//  LWResetPwdCtrl.m
//  laowu
//
//  Created by 曹秀云 on 15/5/2.
//  Copyright (c) 2015年 长沙市岳麓区立早网络科技有限公司. All rights reserved.
//

#import "LWResetPwdCtrl.h"
#import "LWResetSuccCtrl.h"

@interface LWResetPwdCtrl ()

@end

@implementation LWResetPwdCtrl

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"重置密码"];
}

- (IBAction)SubmitBtn:(id)sender {
    if(ISBLANK(self.NewPwdTextFiled.text)){
        [DialogUtils  showTipsWithView:nil String:@"新密码不能为空"];
    }
    if(ISBLANK(self.New2PwdTextFiled.text)){
        [DialogUtils  showTipsWithView:nil String:@"新密码不能为空"];
    }
    if (![self.NewPwdTextFiled.text isEqualToString:self.New2PwdTextFiled.text]){
        [DialogUtils showTipsWithView:nil String:@"两次密码不一致！"];
        return;
    }
    
    
    [MeDataTool change_pswWithParam:self.NewPwdTextFiled.text newpwd:self.New2PwdTextFiled.text success:^(BaseResponse *result) {
        if (result.isSucc) {
            [DialogUtils showTipsWithView:nil String:@"修改密码成功"];
            [self.navigationController pushViewController:[[LWResetSuccCtrl alloc] init] animated:YES];
        }else{
            [DialogUtils showTipsWithView:nil String:result.msg];
        }
    } failure:^(NSError *error) {
        [DialogUtils showTipsWithView:nil String:@"修改密码失败！"];
    }];

}
@end
